<template>
	<view>
		<cu-custom bgColor="bg-gradual-blue" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">订单详情</block>
		</cu-custom>
		
		<view class="main">
			<view class="cu-list menu-avatar">
				<block  v-for="(item,index) in info.items" :key="item.id">
					<view class="cu-item" >
						<view class="cu-avatar radius lg" :style="'background-image:url('+ imageSrc+item.image+');'"></view>
						<view class="content">
							<view class="text-grey">
								<view class="text-cut">{{ item.name }}</view>
							</view>
							<view class="text-gray text-sm flex">
								<view class="text-cut">{{ item.modifiedTime }}</view>
							</view>
						</view>
						<view class="action">
							<view class="text-grey text-xs">数量：{{ item.count }}</view>
							<view class="cu-tag round bg-red sm">{{ item.price }}</view>
						</view>
					</view>
				</block>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				imageSrc: 'http://123.57.7.108:81/',
				info:{},
				orderId:''
			}
		},
		methods: {
			init(id){
				this.orderId = id;
				this.$api.api_getOneOrder({
					id:id
				})
				.then(res =>{
					uni.stopPullDownRefresh();
					this.info = res.data.data;
				})
				.catch(err =>{
					console.log(err)
				})
			}
		},
		onLoad(params) {
			this.init(params.id);
		},
		onPullDownRefresh() {
			this.init(this.orderId);
		}
	}
</script>

<style>

</style>
